package com.atguigu.gulimall.order.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableTransactionManagement // 使用事务管理器
@Configuration
public class OrderMybatisPlusConfig {

    /**
     * 添加分页插件
     */
    @Bean
    public PaginationInterceptor mybatisPlusInterceptor() {
        PaginationInterceptor interceptor = new PaginationInterceptor();
        // 溢出总页数，设置第一页
        interceptor.setOverflow(true);
        // 单页限制 500 条，小于 0 如 -1 不受限制
        interceptor.setLimit(500);
        return interceptor;
    }
}
